﻿<Window x:Class="AzureBlob.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Azure Blob (beta v0.94)" Height="480" Width="680" Icon="/AzureBlob;component/res/icon/azure.ico">
    <Window.Resources>
        <ContextMenu x:Key="TreeViewMenu">
            <MenuItem Header="New Account" Click="NewAccount_Click" />
        </ContextMenu>
        <ContextMenu x:Key="AccountMenu" Opened="Account_ContextMenu_Opened">
            <MenuItem x:Name="Conntect" Header="Conntect" Click="Connect_Click" />
            <MenuItem x:Name="Disconnect" Header="Disconnect" Click="Disconnect_Click" />
            <Separator />
            <MenuItem x:Name="NewContainer" Header="New Container" Click="NewContainer_Click" />
            <Separator />
            <MenuItem x:Name="EditAccount" Header="Edit Account" Click="EditAccount_Click" />
            <MenuItem x:Name="DeleteAccount" Header="Delete Account" Click="DeleteAccount_Click" />
        </ContextMenu>
        <ContextMenu x:Key="ContainerMenu" Opened="Container_ContextMenu_Opened">
            <MenuItem Header="New Folder" Click="Container_NewFolder_MenuItem_Click" />
            <MenuItem Header="Upload Folder" Click="Holder_UploadFolder_MenuItem_Click" />
            <MenuItem Header="Download Folder" Click="Holder_DownloadFolder_MenuItem_Click" />
            <Separator />
            <MenuItem Header="Delete Container" Click="DeleteContainer_MenuItem_Click" />
            <Separator />
            <MenuItem x:Name="PublicMenuItem" Header="Public" Click="Container_PublicMenuItem_Click" />
            <MenuItem x:Name="BlobOnlyMenuItem" Header="Blob Only" Click="Container_BlobOnlyMenuItem_Click" />
            <MenuItem x:Name="PrivateMenuItem" Header="Private" Click="Container_PrivateMenuItem_Click" />    
        </ContextMenu>
        <ContextMenu x:Key="FolderMenu">
            <MenuItem Header="New Folder" Click="Container_NewFolder_MenuItem_Click" />
            <MenuItem Header="Upload Folder" Click="Holder_UploadFolder_MenuItem_Click" />
            <MenuItem Header="Download Folder" Click="Holder_DownloadFolder_MenuItem_Click" />
            <Separator />
            <MenuItem Header="Delete Folder" Click="DeleteFolder_MenuItem_Click" />
        </ContextMenu>
        <ContextMenu x:Key="ListViewMenu">
            <MenuItem Header="Upload Files" Click="ListView_UploadFiles_MenuItem_Click"/>
        </ContextMenu>
        <ContextMenu x:Name="ListItemMenu" x:Key="ListViewItemMenu" Opened="ListItemMenu_Opened" >
            <MenuItem x:Name="ViewInBrowser" Header="View in Browser" Click="ViewInBrowser_Click" />
            <MenuItem x:Name="ViewInBrowserCDN" Header="View in Browser (CDN)" Click="ViewInBrowserCDN_Click" />
            <Separator />
            <MenuItem x:Name="DownloadFiles" Header="Download Files" Click="ListViewItem_DownloadFiles_MenuItem_Click" />
            <MenuItem x:Name="ChangeContentType" Header="Change Content Type" Click="ListViewItem_ChangeContentType_MenuItem_Click"/>
            <!--
            <MenuItem x:Name="ChangeCacheControl" Header="Change Cache Control" Click="ListViewItem_ChangeCacheControl_Click" />
            -->
            <Separator />
            <MenuItem x:Name="DeleteFiles" Header="Delete Files" Click="ListView_DeleteFiles_MenuItem_Click"/>
        </ContextMenu>
        <DataTemplate x:Key="AccountItemTemplate1">
            <StackPanel Orientation="Horizontal">
                <Image VerticalAlignment="Center" Source="/res/icon/Generic_Device.png" Width="20"/>
                <TextBlock TextWrapping="Wrap" Text="{Binding}" VerticalAlignment="Center" FontSize="16"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="AccountItemTemplate2">
            <StackPanel Orientation="Horizontal">
                <Grid>
                    <Image VerticalAlignment="Center" Source="/res/icon/Generic_Device.png" Width="20"/>
                    <Image VerticalAlignment="Center" Source="/res/icon/Likely_unavail.png" Width="20"/>
                </Grid>
                <TextBlock TextWrapping="Wrap" Text="{Binding}" VerticalAlignment="Center" FontSize="16"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="ContainerItemTemplate">
            <StackPanel Orientation="Horizontal">
                <Image VerticalAlignment="Center" Source="/res/icon/base_cylinder_32.png" Width="20"/>
                <TextBlock TextWrapping="Wrap" Text="{Binding}" VerticalAlignment="Center" FontSize="16"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="ContainerItemTemplate1">
            <StackPanel Orientation="Horizontal">
                <Grid>
                    <Image VerticalAlignment="Center" Source="/res/icon/base_cylinder_32.png" Width="20"/>
                    <Image Source="/res/icon/Key.png" Width="12" HorizontalAlignment="Left" Margin="-3,0,0,0" VerticalAlignment="Bottom" />
                </Grid>
                <TextBlock TextWrapping="Wrap" Text="{Binding}" VerticalAlignment="Center" FontSize="16"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="ContainerItemTemplate2">
            <StackPanel Orientation="Horizontal">
                <Grid>
                    <Image VerticalAlignment="Center" Source="/res/icon/base_cylinder_32.png" Width="20"/>
                    <Image Source="/res/icon/SecurityLock.png" Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
                </Grid>
                <TextBlock TextWrapping="Wrap" Text="{Binding}" VerticalAlignment="Center" FontSize="16"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="FolderItemTemplate">
            <StackPanel Orientation="Horizontal">
                <Image VerticalAlignment="Center" Source="/res/icon/Folder.png" Width="20"/>
                <TextBlock TextWrapping="Wrap" Text="{Binding}" VerticalAlignment="Center" FontSize="16"/>
            </StackPanel>
        </DataTemplate>
    </Window.Resources>
    <Grid Name="grid1">
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition Width="160"/>
    		<ColumnDefinition Width="5"/>
    		<ColumnDefinition />
    	</Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="0" />
            <RowDefinition/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>
        <Menu HorizontalAlignment="Stretch" Name="menu1" VerticalAlignment="Top" Grid.ColumnSpan="3" />
        <StatusBar HorizontalAlignment="Stretch" x:Name="statusBar1" VerticalAlignment="Bottom" Grid.Row="2" Grid.ColumnSpan="3" >
            <StatusBarItem HorizontalContentAlignment="Stretch">
        	    <Grid Height="24">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition MinWidth="200" />
                        <ColumnDefinition Width="60"/>
                        <ColumnDefinition Width="180" />
                        <ColumnDefinition Width="80" />
                        
                    </Grid.ColumnDefinitions>
                    <Label Name="statusLabel" Content="status" Padding="0" VerticalAlignment="Center" />
                    <Label x:Name="remainLabel" Content="00:00:00" Padding="0" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1" />
                    <ProgressBar VerticalContentAlignment="Center" Name="progressBar1" Grid.Column="2" />
                    <Label x:Name="progressLabel" Content="%" FontSize="12" Padding="0" HorizontalAlignment="Center" Grid.Column="2" VerticalAlignment="Center" />
                    <Button x:Name="StopBtn" Content="Stop" Grid.Column="3" Click="StopBtn_Click" />
                </Grid>
            </StatusBarItem>
        </StatusBar>
        <TreeView HorizontalAlignment="Stretch" Name="treeView1" VerticalAlignment="Stretch" Grid.Row="1" ContextMenu="{StaticResource ResourceKey=TreeViewMenu}" SelectedItemChanged="TreeViewItem_SelectedItemChanged">
        </TreeView>
        <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" Grid.Row="1"/>
        <ListView Grid.Column="2" Grid.Row="1" Name="listView1" ContextMenu="{StaticResource ResourceKey=ListViewMenu}" AllowDrop="True" DragOver="ListView1_DragOver" Drop="ListView1_Drop">
        	<ListView.View>
        		<GridView>
                    <GridViewColumn Header="Name">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal" ContextMenu="{StaticResource ResourceKey=ListViewItemMenu}">
                                    <Image Source="{Binding Path=Icon}" Width="16" />
                                    <TextBlock Text="{Binding Path=Name}" VerticalAlignment="Center"></TextBlock>
                                </StackPanel>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Header="Content Type" DisplayMemberBinding="{Binding Path=ContentType}" />
                    <GridViewColumn Header="Length" DisplayMemberBinding="{Binding Path=Length}" />
                    <!--
                    <GridViewColumn DisplayMemberBinding="{Binding Path=CacheControl}" Header="Cache Control" />
                    -->
                    <GridViewColumn Header="Last Modified" DisplayMemberBinding="{Binding Path=LastModified}" />
                </GridView>
        	</ListView.View>
        </ListView>
    </Grid>
</Window>
